using System.Collections.ObjectModel;
using OpenAiMobile.Models;

namespace OpenAiMobile.Controls;

// ReSharper disable once RedundantExtendsListEntry
public partial class MessageListControl : ListView
{
    public MessageListControl()
    {
        InitializeComponent();
    }

    public static readonly BindableProperty DataSourceProperty = BindableProperty.Create(
        propertyName: nameof(DataSource),
        returnType: typeof(ObservableCollection<MessageItem>),
        declaringType: typeof(MessageListControl),
        defaultBindingMode: BindingMode.TwoWay
    );

    public ObservableCollection<MessageItem> DataSource
    {
        get => (ObservableCollection<MessageItem>)GetValue(DataSourceProperty);
        set => SetValue(DataSourceProperty, value);
    }
}